package org.glowroot.agent.plugin.hzero;

import org.glowroot.agent.plugin.api.Message;
import org.glowroot.agent.plugin.api.MessageSupplier;
import org.glowroot.agent.plugin.api.checker.Nullable;

import java.util.HashMap;
import java.util.Map;

class JobHandlerMessageSuppplier extends MessageSupplier {

    private final @Nullable String headLine;
    private final String jobMap;
    private final String jobCode;
    private final String jobType;
    private final String jobHandler;

    JobHandlerMessageSuppplier(String headLine, String jobMap, String jobCode, String jobType, String jobHandler) {
        this.headLine = headLine;
        this.jobMap = jobMap;
        this.jobCode = jobCode;
        this.jobType = jobType;
        this.jobHandler = jobHandler;
    }

    @Override
    public Message get() {
        Map<String, Object> detail = new HashMap<String, Object>();
        detail.put("Job Map", jobMap);
        detail.put("JobCode", jobCode);
        detail.put("JobType", jobType);
        detail.put("JobHander", jobHandler);
        return Message.create(headLine, detail);
    }
}
